#define _CRT_SECURE_NO_WARNINGS 1

int* findErrorNums(int* nums, int numsSize, int* returnSize) {
    int* count = (int*)calloc(numsSize + 1, sizeof(int));
    int* arr = (int*)malloc(8);
    int rep;
    for (int i = 0; i < numsSize; ++i)
    {
        if (count[nums[i]] == 1)
            rep = nums[i];
        ++count[nums[i]];
    }
    for (int i = 1; i <= numsSize; ++i)
    {
        if (count[i] == 2)
            arr[0] = rep;
        if (count[i] == 0)
            arr[1] = i;
    }
    *returnSize = 2;
    return arr;
}